package com.healthy.service.impl;

import java.util.List;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.healthy.entity.YgColumn;
import com.healthy.mapper.YgColumnMapper;
import com.healthy.service.YgColumnService;

@Service
@Transactional
public class YgColumnServiceImpl implements YgColumnService {
	
	// 注入Mapper接口
	@Autowired
	private YgColumnMapper columnMapper;

	// 移动端-》专栏功能一、用户添加专栏
	@Override
	public boolean addColumn(String uid, String name) {
		return this.columnMapper.addColumn(uid, name);
	}

	// 移动端-》专栏功能一、用户添加专栏，判断专栏是否存在
	@Override
	public List<YgColumn> findColumnByName(String uid,String name) {
		return this.columnMapper.findColumnByName(uid,name);
	}

	/*
	 *  移动端-》专栏功能二，用户查看自己全部专栏
	 */
	@Override
	public List<YgColumn> allColumn(String uid) {
		return this.columnMapper.allColumn(uid);
	}
	
	// 移动端-》专栏功能二、通过专栏id查找专栏信息
	@Override
	public YgColumn findColumnById(String id) {
		return this.columnMapper.findColumnById(id);
	}
	
	// 移动端-》专栏功能三、查询某个专栏下的全部文章
	@Override
	public List<YgColumn> findUserByColumn(String name) {
		return this.columnMapper.findUserByColumn(name);
	}
	
	// 移动端-》专栏功能四、用户修改文章所属的专栏
	@Override
	public boolean updateDocumentByColumn(String name,String new_name, String did) {
		return this.columnMapper.updateDocumentByColumn(name,new_name,did);
	}

	// 移动端-》专栏功能五、用户删除专栏
	@Override
	public boolean deleteDocumentByColumn(String uid, String name) {
		return this.columnMapper.deleteDocumentByColumn(uid,name);
	}

	// 移动端-》专栏功能六、用户取消专栏下的文章收藏
	@Override
	public boolean deleteColumnByDocument(String uid, String name, String did) {
		return this.columnMapper.deleteColumnByDocument(uid,name,did);
	}
	
	// 移动端-》专栏功能七、判断当前专栏下是否已收藏当前文章
	@Override
	public YgColumn findColumnBydid(String uid, String name, String did) {
		return this.columnMapper.findColumnBydid(uid,name,did);
	}

	// 移动端-》专栏功能八、选择文章放入到专栏
	@Override
	public boolean addDocumentByColumn(String uid,String name,String did){
		return this.columnMapper.addDocumentByColumn(uid,name,did);
	}

	// 移动端-》专栏功能九、用户修改专栏名称
	@Override
	public boolean updateColumnByName(String uid, String name, String new_name) {
		return this.columnMapper.updateColumnByName(uid,name,new_name);
	}

		

}
